/*
 * $Id: SysCode.java 14 2014-08-15 11:50:17Z ratking $
 *
 * Copyleft (C) 2014 RatKing. All wrongs reserved.
 */
package cn.ratking.demo.jaws7.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 系统代码
 */
@Entity
@Table(name = "T_SysCode")
public class SysCode implements Serializable {

    /** 系统代码ID */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long sysCodeId;
    /** 类别 */
    @NotNull
    @Size(max = 50)
    private String codeType;
    /** 名称 */
    @Size(max = 200)
    private String codeName;
    /** 代码 */
    @Size(max = 200)
    private String codeValue;
    /** 是否启用(false/0-禁用 true/1-启用) */
    private boolean enabled;
    /** 排序序号 */
    private Integer orderNo;
    /** 备注 */
    @Size(max = 1000)
    private String remark;
    /** 创建时间 */
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    /** 更新时间 */
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;
    /** 版本(用于JPA乐观锁) */
    @Version
    private int version;

    /** 无参构造方法 */
    public SysCode() {
    }

    public Long getSysCodeId() {
        return sysCodeId;
    }

    public void setSysCodeId(Long sysCodeId) {
        this.sysCodeId = sysCodeId;
    }

    public String getCodeType() {
        return codeType;
    }

    public void setCodeType(String codeType) {
        this.codeType = codeType;
    }

    public String getCodeName() {
        return codeName;
    }

    public void setCodeName(String codeName) {
        this.codeName = codeName;
    }

    public String getCodeValue() {
        return codeValue;
    }

    public void setCodeValue(String codeValue) {
        this.codeValue = codeValue;
    }

    public boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public Integer getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Integer orderNo) {
        this.orderNo = orderNo;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(sysCodeId);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof SysCode)) {
            return false;
        }
        final SysCode other = (SysCode) obj;
        return Objects.equals(this.sysCodeId, other.sysCodeId);
    }

    /**
     * 返回测试字符串
     *
     * @return 测试字符串
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("[SysCode: sysCodeId=").append(sysCodeId);
        sb.append(", codeType=").append(codeType);
        sb.append(", codeName=").append(codeName);
        sb.append(", codeValue=").append(codeValue);
        sb.append(", enabled=").append(enabled);
        sb.append(", orderNo=").append(orderNo);
        sb.append(", remark=").append(remark);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", version=").append(version);
        sb.append("]");

        return sb.toString();
    }
}
